<!DOCTYPE html>
<html>
      <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width,initial-scale=1">
            <title>滚动监听</title>
            <link rel="stylesheet" href="https://cdn.staticfile.net/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
            <script src="https://cdn.staticfile.net/jquery/3.2.1/jquery.min.js"></script>
            <script src="https://cdn.staticfile.net/popper.js/1.15.0/umd/popper.min.js"></script>
            <script src="https://cdn.staticfile.net/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
            <style>
                  body {
                        position: relative;
                  }
            </style>
      </head>
      <body data-spy="scroll" data-target=".navbar" data-offset="50">
            <nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
                  <ul class="navbar-nav">
                        <li class="navbar-item">
                              <a class="nav-link" href="#section1">导航一</a>
                        </li>
                        <li class="navbar-item">
                              <a class="nav-link" href="#section2">导航二</a>
                        </li>
                        <li class="navbar-item">
                              <a class="nav-link" href="#section3">导航三</a>
                        </li>
                        <li class="navbar-item dropdown">
                              <a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">导航四</a>
                              <div class="dropdown-menu">
                                    <a class="dropdown-item" href="#section4_1">链接一</a>
                                    <a class="dropdown-item" href="#section4_2">链接二</a>
                              </div>
                        </li>
                  </ul>
            </nav>
            <div id="section1" class="container-fluid bg-success" style="padding-top: 70px;padding-bottom: 70px;">
                  <h1>section1</h1>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
            </div>
            <div id="section2" class="container-fluid bg-warning" style="padding-top: 70px;padding-bottom: 70px;">
                  <h1>section2</h1>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
            </div>
            <div id="section3" class="container-fluid bg-secondary" style="padding-top: 70px;padding-bottom: 70px;">
                  <h1>section3</h1>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
            </div>
            <div id="section4_1" class="container-fluid bg-danger" style="padding-top: 70px;padding-bottom: 70px;">
                  <h1>section4_1</h1>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
            </div>
            <div id="section4_2" class="container-fluid bg-info" style="padding-top: 70px;padding-bottom: 70px;">
                  <h1>section4_2</h1>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
                  <p>Try to scroll this section and look at the navigation bar while scrolling! Try to scroll this section and look at the navigation bar while scrolling!</p>
            </div>
      </body>
</html>